<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.List" %>
<%@ page import="net.greyar.theory.View" %>
<%@ page import="net.greyar.gear.Machine" %>
<%@ page import="net.greyar.model.User" %>
<%@ page import="net.greyar.theory.Symbol" %>
<% User user = (User) session.getAttribute("user"); %>
<% View view = user.getGrid().view(user.getName()); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<pre>
rules ::
<% 
	for (int i = 0; i < view.getRules().size(); i++) {
		%><%=view.getRules().get(i)%><br /><%
	} %>
state ::
<% 
	List<Symbol> results = view.results(Symbol.parse("(sees " + user.getName() + " ?data)"));
	for (int i = 0; i < results.size(); i++) {
		%><%=results.get(i)%><br /><%
	} %>
moves ::
<% 
	results = view.results(Symbol.parse("(does ?anyone ?action)"));
	for (int i = 0; i < results.size(); i++) {
		%><%=results.get(i)%><br /><%
	} %>
legal ::
<% 
	results = view.results(Symbol.parse("(legal " + user.getName() + " ?action)"));
	for (int i = 0; i < results.size(); i++) {
		%><%=results.get(i)%><br /><%
	} %>
log ::
<% 
	for (int i = 0; i < view.getLog().size(); i++) {
		%><%=view.getLog().get(i)%><br /><%
	} %>
</pre>
</body>
</html>